package com.zy.composeworld.ui.screens.resource

import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
import androidx.compose.animation.graphics.res.animatedVectorResource
import androidx.compose.animation.graphics.vector.AnimatedImageVector
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.lazy.staggeredgrid.LazyVerticalStaggeredGrid
import androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.Info
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material.icons.filled.Person
import androidx.compose.material.icons.rounded.Add
import androidx.compose.material.icons.rounded.Home
import androidx.compose.material.icons.rounded.Menu
import androidx.compose.material.icons.rounded.Notifications
import androidx.compose.material3.BottomAppBar
import androidx.compose.material3.Button
import androidx.compose.material3.Divider
import androidx.compose.material3.DrawerValue
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExtendedFloatingActionButton
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MediumTopAppBar
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.ModalDrawerSheet
import androidx.compose.material3.ModalNavigationDrawer
import androidx.compose.material3.NavigationDrawerItem
import androidx.compose.material3.RangeSlider
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Slider
import androidx.compose.material3.SliderDefaults
import androidx.compose.material3.SnackbarDuration
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.SnackbarResult
import androidx.compose.material3.Switch
import androidx.compose.material3.SwitchDefaults
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.TopAppBarDefaults.topAppBarColors
import androidx.compose.material3.rememberDrawerState
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.material3.rememberTopAppBarState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.zy.composeworld.R
import com.zy.composeworld.ui.screens.switch.SwitchMinimalExample
import com.zy.composeworld.ui.screens.switch.SwitchWithCustomColors
import com.zy.composeworld.ui.screens.switch.SwitchWithIconExample
import kotlinx.coroutines.launch


@OptIn(ExperimentalAnimationGraphicsApi::class)
@Composable
fun ResourceExample() {
    val scope = rememberCoroutineScope()
    val snackbarHostState = remember { SnackbarHostState() }

    val smallPadding = dimensionResource(R.dimen.padding_small)


    Scaffold(snackbarHost = {
        SnackbarHost(hostState = snackbarHostState)
    }, floatingActionButton = {
        ExtendedFloatingActionButton(text = { Text("Show snackbar") },
            icon = { Icon(Icons.Filled.Person, contentDescription = "") },
            onClick = {
                scope.launch {
                    snackbarHostState.showSnackbar("Snackbar $this")
                }
            })
    }) { innerPadding ->


        LazyColumn(
            modifier = Modifier.padding(innerPadding),
            verticalArrangement = Arrangement.spacedBy(16.dp),
        ) {

            item {
                Text(text = "资源")
            }
            item {
                Text(text = "字符串")
            }



            item {
                Text(
                    text = stringResource(R.string.compose)
                )
            }

            item {
                Text(text = "位置格式设置")
            }

            item {
                Text(
                    text = stringResource(R.string.congratulate, "New Year", 2024)
                )
            }

            item {
                Text(text = "尺寸")
            }


            item {
                Text(
                    text = "padding 8dp",
                    modifier = Modifier.padding(smallPadding)
                )
            }

            item {
                Text(text = "颜色")
            }

            item {
                Divider(color = colorResource(R.color.purple_200))
            }
            item {
                Divider(color = colorResource(R.color.black))
            }
            item {
                Divider(color = colorResource(R.color.teal_200))
            }


            item {
                Text(text = "矢量资源和图像资源")
            }
            item {
                Icon(
                    painter = painterResource(id = androidx.core.R.drawable.ic_call_answer),
                    contentDescription = null
                )
            }

//            item {
//                Text(text = "带动画的矢量可绘制对象")
//            }
//
//
//            item {
//                Icon(
//                    painter = painterResource(id = androidx.core.R.drawable.ic_call_answer),
//                    contentDescription = null
//                )
//            }

            item {
                Text(text = "图标")
            }

            item {

                Row {
                    Icon(Icons.Rounded.Menu, contentDescription = "Localized description")
                    Icon(Icons.Rounded.Add, contentDescription = "Localized description")
                    Icon(Icons.Rounded.Home, contentDescription = "Localized description")
                    Icon(Icons.Rounded.Notifications, contentDescription = "Localized description")
                }
            }

            item {
                Text(text = "字体")
            }


        }

    }
}




